<template>
  <div class='container'>
    <el-dialog
      title="预览文章"
      :visible.sync="previewDialogVisible"
      width="800px"
      :before-close="handleClose">
      <div class="title">
        <h2><div v-html="aticleDetail.title"></div></h2>
        <span v-html="formatTime(aticleDetail.createTime)"></span>
        <span class="username" v-html="username"></span>
        <i class="el-icon-view"></i>
        <span class="visits" v-html="aticleDetail.visits"></span>
      </div>
      <div class="content" v-html="aticleDetail.articleBody"></div>
      <!-- <span slot="footer" class="dialog-footer">
        <el-button @click="$emit('input', false)">取 消</el-button>
        <el-button type="primary" @click="$emit('input', false)">确 定</el-button>
      </span> -->
    </el-dialog>
  </div>
</template>

<script>
export default {
  name: 'articlesPreview',
  model: {
    prop: 'previewDialogVisible'
  },
  props: {
    previewDialogVisible: {
      type: Boolean,
      required: true
    },
    aticleDetail: {
      type: Object,
      required: true
    },
    username: {
      type: String,
      required: true
    }
  },
  data () {
    return {

    }
  },

  created () {

  },

  methods: {
    handleClose () {
      this.$emit('input', false)
    }
  }
}
</script>

<style scoped lang='less'>
.title{
  border-bottom: 1px dashed #ccc;
  padding-bottom: 10px;
}
.content{
  background: #f5f5f5;
  padding: 10px;
}
/deep/.visits{
  margin-left: 10px;
}
.el-icon-view{
  margin-left: 10px;
}
.username{
  margin-left: 10px;
}
</style>
